﻿using System;
using System.Text;

delegate void UniversalSequenceSum(StringBuilder result);

class SumSequences
{
    public static void SumOfFirstSequence(StringBuilder result)
    {
        double sum = 1;
        double fractionSum = 0;
        double i = 2;
        do
        {
            fractionSum = 1 / (i);
            sum += fractionSum;
            i *= 2;
        } while (fractionSum > 0.01);
        result.Append(sum.ToString() + '\n');
    }

    public static void SumOfSecondSequence(StringBuilder result)
    {
        double sum = 1;
        double fractionSum = 0;
        double i = 2;
        do
        {
            fractionSum = 1 / (i);
            sum += fractionSum;
            i = i * (i + 1);
        } while (fractionSum > 0.01);
        result.Append(sum.ToString() + '\n');
    }

    public static void SumOfThirdSequence(StringBuilder result)
    {
        double sum = 1;
        double fractionSum = 0;
        double i = 2;
        do
        {
            fractionSum = 1 / (i);
            sum += fractionSum;
            i *= 2 * (-1);
        } while (Math.Abs(fractionSum) > 0.01);
        result.Append(sum.ToString());
    }
      
    private static StringBuilder UniversalMethod()
    {
        UniversalSequenceSum dg = SumOfFirstSequence;
        dg += SumOfSecondSequence;
        dg += SumOfThirdSequence;
        StringBuilder res = new StringBuilder();
        dg(res);
        return res;
    }

    static void Main()
    {
        StringBuilder res = UniversalMethod();
        Console.WriteLine(res);
    }
}

